<?php
namespace Home\Controller;
use Think\Controller;
class FormController extends Controller {
     public function index(){
        $db=  M('Form');
         $result =   $db->select();
         $this->assign('list',$result);
        $this->display();
    }
   public function add(){
        $this->display();
    }
     public function insert(){
      $code = I('post.vco');
      $verify = new \Think\Verify();
      $ret = $verify->check($code);
      if(!$ret){
        $this->error('验证码错误','',5);
      }



      $db   =   M('Form');
      $data['title']  = I('post.title');
      $data['content']    = I('post.content');
      $data['create_time']  = time();
      $db->add($data);
    }
     public function del(){
      $db=  M('Form');
      $db->delete(3);
         
    
    }
    public function vco(){
           $config =    array(
            'fontSize'    =>    30,    // 验证码字体大小
            'length'      =>    5,     // 验证码位数
            'useNoise'    =>    false, // 关闭验证码杂点
           
            'useZh'       =>     true,
             'fontttf'     =>     'STXINGKA.TTF',
        );
        $Verify =     new \Think\Verify($config);
        $Verify->entry();
    }




}





